/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Excersize2_Swing;

import battleshipgame.logic.Player;
import Excersize2_Swing.SwingCommand;

/**
 *
 * @author אלירן
 */
public class AddPlayerCommand extends SwingCommand {

    Player player;
    int id;

    @Override
    void RevertCommand() {
        if (this.do_or_undo == SwingCommand.DO_OR_UNDO.DO) {
            referBattleshipGameJFrame.changePlayerFocus(id);
            referBattleshipGameJFrame.RemoveFocusedPlayer();
        } else {
            referBattleshipGameJFrame.AddPlayer(player);
        }
    }

    public AddPlayerCommand(Player player, int id, DO_OR_UNDO do_or_undo, BattleshipGameJFrame referBattleshipGameJFrame) {
        super(do_or_undo, referBattleshipGameJFrame);
        this.player = player;
        this.id = id;
    }
}
